package kr.pe.johnkim.pushchat.mobile.service;

import kr.pe.johnkim.pushchat.mobile.dao.PushChatCertificationDao;
import kr.pe.johnkim.pushchat.mobile.domain.PushChatSMS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author : John_Kim <cale9797@gmail.com>
 * @date : 13. 6. 27.
 */
@Service
public class PushChatCertificationServiceImpl implements PushChatCertificationService {

    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(PushChatCertificationServiceImpl.class);

    @Autowired
    private PushChatCertificationDao pushChatCertificationDao;

    /**
     * 인증 번호를 등록 한다.
     *
     * @param pushChatSMS
     */
    @Override
    public void registerCertification(PushChatSMS pushChatSMS) {
        logger.info("registerCertification");
        this.pushChatCertificationDao.registerCertification(pushChatSMS);
    }

    /**
     * 해당 사용자의 인증 정보가 있는지 확인 한다.
     *
     * @param pushChatSMS
     * @return
     */
    @Override
    public PushChatSMS selectExistCertificationInformation(PushChatSMS pushChatSMS) {
        logger.info("selectExistCertificationInformation");
        return this.pushChatCertificationDao.selectExistCertificationInformation(pushChatSMS);
    }

    /**
     * 해당 사용자의 인증 정보를 가져 온다.
     *
     * @param pushChatSMS
     * @return
     */
    @Override
    public PushChatSMS selectCertificationInformation(PushChatSMS pushChatSMS) {
        logger.info("selectCertificationInformation");
        return this.pushChatCertificationDao.selectCertificationInformation(pushChatSMS);
    }

    /**
     * 해당 인증 번호를 비활성화 한다.
     *
     * @param pushChatSMS
     */
    @Override
    public void updateDeactivateCertification(PushChatSMS pushChatSMS) {
        logger.info("updateDeactivateCertification");
        this.pushChatCertificationDao.updateDeactivateCertification(pushChatSMS);
    }
}
